import time

def hup(a, N):
    for i in range(N-1):
        for j in range(N-i-1):
            if a[j] > a[j+1]:
                a[j], a[j+1] = a[j+1], a[j]
    

def answer(filename):   
	file = open(filename, 'r')    
	data = file.readlines()    
	return data

m1 = answer("m1_sorted.txt") 
our = len(m1) 
t_start = time.time() 
hup(m1, our) 
t_finish = time.time() 
print("m1_sorted.txt ",round((t_finish-t_start)*1000),"milliseconds")

m2 = answer("m2_reverse.txt") 
our = len(m2) 
t_start = time.time() 
hup(m2, our) 
t_finish = time.time() 
print("m2_reverse.txt ",round((t_finish-t_start)*1000),"milliseconds")

m3 = answer("m3_shuffle.txt") 
our = len(m3) 
t_start = time.time() 
hup(m3, our) 
t_finish = time.time() 
print("m3_shuffle",round((t_finish-t_start)*1000),"milliseconds")

                
        
    
